home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-06-08 | 42.5 KB | 1,196 lines |
- _global.setTimeout = function(a, b, c, args)
- {
- if(typeof arguments[0] == "function")
- {
- args = arguments.slice(2);
- var ID;
- var func = function()
- {
- a.apply(null,args);
- clearInterval(ID);
- };
- ID = setInterval(func,b,args);
- }
- else
- {
- args = arguments.slice(3);
- var ID;
- var func = function()
- {
- a[b].apply(a,args);
- clearInterval(ID);
- };
- ID = setInterval(func,c,args);
- }
- return ID;
- };
- _global.clearTimeout = clearInterval;
- MovieClip.prototype.drawrectangle = function(x, y, w, h)
- {
- this.moveTo(x,y);
- this.lineTo(x + w,y);
- this.lineTo(x + w,y + h);
- this.lineTo(x,y + h);
- this.lineTo(x,y);
- };
- Math.linearTween = function(t, b, c, d)
- {
- return c * t / d + b;
- };
- HFHierMenuClass = function()
- {
- this.init();
- };
- HFHierMenuClass.prototype = new MovieClip();
- HFHierMenuClass.prototype.init = function()
- {
- if(_root.itemToCreate == 13)
- {
- _root.itemToCreate = 0;
- _root.itemX = 0;
- _root.itemXNew = 0;
- }
- this.family = new Array();
- this.highlightedItems = new Array();
- this.radioGroups = new Array();
- if(this.applySound)
- {
- this.rollOverSndObj = new Sound();
- this.rollOverSndObj.attachSound(this.rollOverSnd);
- this.pressSndObj = new Sound();
- this.pressSndObj.attachSound(this.pressSnd);
- }
- this.getXMLContent();
- if(this.menuSlide)
- {
- this.createEmptyMovieClip("$tmpMaskMC",-200);
- }
- this.padding = 5;
- this.depth = -1;
- this.isOnSub = false;
- this.parentPressedLabel = "";
- this.pressedLabel = "";
- this.pressedIdx = null;
- this.isOnClick = false;
- this.currentIdx = 0;
- if(this.xmlFileName == "disclaimer")
- {
- if(_level1._root.translating)
- {
- _level1._root.translatorController.play();
- }
- else if(_level1._root.skip)
- {
- _level1._root.menuHider.topMenuHider.gotoAndStop(10);
- }
- else
- {
- _level1._root.menuHider.topMenuHider.gotoAndPlay("showMenu");
- }
- }
- };
- HFHierMenuClass.prototype.getXMLContent = function()
- {
- this.xmlObj = new XML();
- this.xmlName = this.xmlFileName + "_" + _level1._root.lang + ".xml";
- if(_level1._root.test or _level1._root.test == undefined)
- {
- this.xmlObj.load(this.xmlName);
- }
- else
- {
- temp = "flash/" + this.xmlName;
- this.xmlObj.load(temp);
- }
- this.xmlObj.parent = this;
- this.xmlObj.onLoad = this.handle_xml_load;
- };
- HFHierMenuClass.prototype.handleItemNode = function(node, m)
- {
- var isCheckBox;
- var checkBoxIsActive;
- if(node.attributes.checkbox == "true")
- {
- isCheckBox = true;
- }
- else
- {
- isCheckBox = false;
- }
- if(node.attributes.active == "true")
- {
- checkBoxIsActive = true;
- }
- else
- {
- checkBoxIsActive = false;
- }
- if(node.attributes.disabled == "true")
- {
- disabled = true;
- }
- else
- {
- disabled = false;
- }
- var itemArray = [node.attributes.name,m != 1 ? Number(node.hasChildNodes()) : Number(node.attributes.sub),node.attributes.action,node.attributes.alterCaption,isCheckBox,checkBoxIsActive,disabled];
- return itemArray;
- };
- HFHierMenuClass.prototype.handleXMLNodeSubs = function(node, n, ch)
- {
- if(node.nodeName == "item")
- {
- var itemArray = this.handleItemNode(node,2);
- if(ch == "")
- {
- this.dp.push(itemArray);
- }
- else
- {
- this["dp_" + ch].push(itemArray);
- }
- }
- else if(node.nodeName == "title")
- {
- if(ch == "")
- {
- this.dp[0] = node.attributes.name;
- }
- else
- {
- this["dp_" + ch][0] = node.attributes.name;
- }
- }
- else if(node.nodeName == "sep")
- {
- if(ch == "")
- {
- this.dp.push("sep");
- }
- else
- {
- this["dp_" + ch].push("sep");
- }
- }
- else if(node.nodeName == "radiogroup")
- {
- var RG_childNodes = node.childNodes;
- var u = 0;
- while(u < RG_childNodes.length)
- {
- if(RG_childNodes[u].nodeName == "item")
- {
- var tempItemArray = this.handleItemNode(RG_childNodes[u],1);
- if(ch == "")
- {
- this.dp.push(tempItemArray);
- }
- else
- {
- this["dp_" + ch].push(tempItemArray);
- }
- }
- if(RG_childNodes[u].nodeName == "sep")
- {
- if(ch == "")
- {
- this.dp.push("sep");
- }
- else
- {
- this["dp_" + ch].push("sep");
- }
- }
- if(RG_childNodes[u].nodeName != "item")
- {
- RG_childNodes.splice(u,1);
- u--;
- }
- u++;
- }
- var radioItemObj = new Object();
- radioItemObj.groupName = node.attributes.name;
- radioItemObj.dp_name = ch != "" ? "dp_" + ch : "dp";
- radioItemObj.start_idx = n;
- radioItemObj.end_idx = radioItemObj.start_idx + RG_childNodes.length;
- radioItemObj.active = node.attributes.active;
- this.radioGroups.push(radioItemObj);
- }
- if(node.hasChildNodes())
- {
- var cn = node.childNodes;
- var counter = cn.length;
- var count = 0;
- var old_chain = new String(ch);
- var idString = new String(n);
- var new_chain;
- if(old_chain == "")
- {
- new_chain = idString;
- }
- else
- {
- new_chain = old_chain + "_" + idString;
- }
- this["dp_" + new_chain] = [];
- this["dp_" + new_chain][0] = "";
- var i = 0;
- while(i < counter)
- {
- if(cn[i].nodeName == "item" || cn[i].nodeName == "title" || cn[i].nodeName == "sep" || cn[i].nodeName == "radiogroup")
- {
- this.handleXMLNodeSubs(cn[i],i - count,new_chain);
- }
- if(cn[i].nodeName != "item" && cn[i].nodeName != "checkgroup" && cn[i].nodeName != "null")
- {
- count++;
- }
- i++;
- }
- }
- };
- HFHierMenuClass.prototype.handle_xml_load = function(success)
- {
- if(success)
- {
- if(this.firstChild.nodeName == "hiermenu")
- {
- this.parent.method = this.firstChild.attributes.method;
- if(this.parent.method == "2")
- {
- this.parent.dp = new Array();
- this.parent.dp[0] = "";
- var childs = this.firstChild.childNodes;
- var i = 0;
- while(i < childs.length)
- {
- if(childs[i].nodeName == "item" || childs[i].nodeName == "title" || childs[i].nodeName == "sep")
- {
- this.parent.handleXMLNodeSubs(childs[i],i - count,"");
- }
- if(childs[i].nodeName != "item" && childs[i].nodeName != "null")
- {
- count++;
- }
- i++;
- }
- }
- else
- {
- var childs = this.firstChild.childNodes;
- var i = 0;
- while(i < childs.length)
- {
- var name = childs[i].nodeName;
- if(name.substring(0,2) == "dp")
- {
- var titleExist;
- this.parent[name] = new Array();
- subchilds = childs[i].childNodes;
- if(childs[i].attributes.title == "true")
- {
- titleExist = true;
- }
- else
- {
- titleExist = false;
- this.parent[name][0] = "";
- }
- var j = 0;
- while(j < subchilds.length)
- {
- if(subchilds[j].nodeName != null)
- {
- var itemArray = this.parent.handleItemNode(subchilds[j],1);
- if(_level1._root.menuName == this.parent.xmlFileName)
- {
- if(itemArray[1] == _root.menuId - 1 and itemArray[2] == "no")
- {
- _root.menuLabel = itemArray[0];
- _root.alternativeCaption = "";
- }
- else if(itemArray[2] == _root.currentAction)
- {
- _root.menuSubLabel = itemArray[0];
- _root.alternativeCaption = itemArray[3];
- }
- }
- if(this.parent.xmlFileName == "menu" and itemArray[2].slice(0,7) == "volumes")
- {
- counter = Math.round(j / 2);
- _root.volumeAlternative[counter] = itemArray[3];
- }
- if(this.parent.xmlFileName == "menu" and itemArray[2] == "support/product_specification")
- {
- _root.idSpecifications = Math.round(j / 2);
- _root.captionSpecifications = itemArray[0];
- _root.alternativeSpecifications = itemArray[3];
- }
- if(this.parent.xmlFileName == "menu" and itemArray[1] == "2")
- {
- _root.parSpecifications = itemArray[0];
- }
- if(subchilds[j].nodeName == "radiogroup")
- {
- var RG_childNodes = subchilds[j].childNodes;
- var u = 0;
- while(u < RG_childNodes.length)
- {
- if(RG_childNodes[u].nodeName == "item")
- {
- var tempItemArray = this.parent.handleItemNode(RG_childNodes[u],1);
- this.parent[name].push(tempItemArray);
- }
- if(RG_childNodes[u].nodeName == "sep")
- {
- this.parent[name].push("sep");
- }
- if(RG_childNodes[u].nodeName != "item")
- {
- RG_childNodes.splice(u,1);
- u--;
- }
- u++;
- }
- var radioItemObj = new Object();
- radioItemObj.groupName = subchilds[j].attributes.name;
- radioItemObj.dp_name = name;
- radioItemObj.start_idx = parseInt(j) - 1;
- radioItemObj.end_idx = radioItemObj.start_idx + RG_childNodes.length - 1;
- radioItemObj.active = subchilds[j].attributes.active;
- this.parent.radioGroups.push(radioItemObj);
- }
- if(titleExist)
- {
- if(subchilds[j].nodeName == "title")
- {
- this.parent[name][0] = subchilds[j].attributes.name;
- }
- else if(subchilds[j].nodeName == "item")
- {
- this.parent[name].push(itemArray);
- }
- else if(subchilds[j].nodeName == "sep")
- {
- this.parent[name].push("sep");
- }
- }
- else
- {
- if(subchilds[j].nodeName == "item")
- {
- this.parent[name].push(itemArray);
- }
- if(subchilds[j].nodeName == "sep")
- {
- this.parent[name].push("sep");
- }
- }
- }
- j++;
- }
- }
- i++;
- }
- }
- }
- this.parent.createMenu(0,0,0,this.parent.dp,"dp");
- }
- else
- {
- trace(" > ERROR: The file " + this.xmlFileName + " has not been found");
- }
- };
- HFHierMenuClass.prototype.createMenu = function(x, y, hier, dp, dp_name, ox, oy)
- {
- this.depth = this.depth + 1;
- this.numSep = 0;
- var menu = this.createEmptyMovieClip("menu_" + this.depth,this.depth);
- menu._alpha = Number(!this.menuFade) * 100;
- menu.treePos = hier;
- menu.depth = this.depth;
- if(this.menuSlide)
- {
- if(this.menuType == "Vertical" || hier > 0)
- {
- menu._x = ox;
- menu._y = y;
- }
- else if(this.menuType == "Horizontal" && hier == 0)
- {
- menu._x = x;
- menu._y = oy;
- }
- }
- else
- {
- menu._x = x;
- menu._y = y;
- }
- var parent_array = "dp";
- var z = 0;
- while(z < this.family.length - 1)
- {
- parent_array += "_" + this.family[z];
- z++;
- }
- var array_ref = this[parent_array];
- var pID = this.family[hier - 1] + 1 + this.getNumSeps(array_ref,this.family[hier - 1]);
- if(dp_name == parent_array)
- {
- menu.parentLabel = "";
- }
- else
- {
- menu.parentLabel = array_ref[pID][0];
- }
- menu.parentItemRef = this["menu_" + (this.depth - 1)]["PItem_" + pID];
- menu.pID = pID;
- if(this.autoSizeWidth)
- {
- this.menuWidth = this.getMenuWidth(dp);
- }
- var titleExist = dp[0] != "";
- var numTitleExist = Number(!titleExist);
- if(this.menuType == "Vertical" || hier > 0)
- {
- if(dp[0] != "")
- {
- this.titleInitObj = new Object();
- this.titleInitObj._x = this.titleInitObj._y = 0;
- this.titleInitObj.parent = this;
- this.titleInitObj.txtColor = this.titleTxtColor;
- this.titleInitObj.txtLabel = dp[0];
- this.titleInitObj.txtAlign = "center";
- this.titleInitObj.menuWidth = this.menuWidth;
- this.titleInitObj.txtIsBold = true;
- this.titleInitObj.bgColor = this.titleBGColor;
- this.titleInitObj.isTitle = true;
- menu.attachMovie("ItemSymbol","MTitle",0,this.titleInitObj);
- }
- }
- var applyRadio = false;
- radioSpecs.splice(0,radioSpecs.length);
- var radioSpecs = new Array();
- var c = 0;
- while(c < this.radioGroups.length)
- {
- if(this.radioGroups[c].dp_name == dp_name)
- {
- applyRadio = true;
- radioSpecs.push(this.radioGroups[c]);
- }
- c++;
- }
- var i = 1;
- while(i < dp.length)
- {
- if(_root.itemToCreate < _root.upperMenuCount + 1)
- {
- this.menuWidth = this.getOneMenuWidth(dp[i][0]);
- _root.itemX += this.menuWidth;
- if(_root.itemToCreate < 1)
- {
- _root.itemXNew = 0;
- }
- if(_root.itemToCreate == _root.upperMenuCount)
- {
- _root.itemX = 0;
- }
- }
- else if(_root.itemToCreate < _root.upperMenuCount + _root.bottomMenuCount + 1)
- {
- this.menuWidth = this.getOneMenuWidth(dp[i][0]);
- _root.itemX += this.menuWidth;
- if(_root.itemToCreate == _root.upperMenuCount + 1)
- {
- _root.itemXNew = 0;
- }
- }
- else
- {
- this.menuWidth = this.getMenuWidth(dp);
- _root.itemToCreate = _root.upperMenuCount + _root.bottomMenuCount + 2;
- }
- _root.itemToCreate = _root.itemToCreate + 1;
- if(dp[i] == "sep")
- {
- if(this.menuType == "Vertical" || hier > 0)
- {
- menu.createEmptyMovieClip("sep_" + i,- (i + 1));
- menu["sep_" + i]._y = (i - numTitleExist) * this.menuItemHeight - this.numSep * (this.menuItemHeight - 8);
- menu["sep_" + i].beginFill(this.upBGColor,100);
- menu["sep_" + i].drawrectangle(0,0,this.menuWidth,8);
- menu["sep_" + i].endFill();
- menu["sep_" + i].lineStyle(0,this.blockLineColor,100);
- menu["sep_" + i].moveTo(5,4);
- menu["sep_" + i].lineTo(this.menuWidth - 5,4);
- }
- this.numSep += 1;
- }
- else if(dp[i][0] != "")
- {
- this.itemInitObj = new Object();
- if(this.menuType == "Vertical" || hier > 0)
- {
- this.itemInitObj._x = 0;
- this.itemInitObj._y = (i - numTitleExist) * this.menuItemHeight - this.numSep * (this.menuItemHeight - 8) - 1;
- }
- else if(this.menuType == "Horizontal" && hier == 0)
- {
- this.itemInitObj._x = _root.itemXNew;
- _root.itemXNew = _root.itemX;
- this.itemInitObj._y = 0;
- this.itemInitObj.firstHoriz = true;
- }
- var disabled = dp[i][5];
- this.itemInitObj.id = i - this.numSep;
- this.itemInitObj.parent = this;
- this.itemInitObj.txtColor = this.upFontColor;
- this.itemInitObj.txtLabel = dp[i][0];
- this.itemInitObj.txtIsBold = false;
- this.itemInitObj.bgColor = this.upBGColor;
- this.itemInitObj.txtAlign = "left";
- this.itemInitObj.menuWidth = this.menuWidth;
- this.itemInitObj.hasSubs = dp[i][1];
- this.itemInitObj.actionToLoad = dp[i][2];
- this.itemInitObj.alternativeCaption = dp[i][3];
- this.itemInitObj.isCheckBox = dp[i][3];
- this.itemInitObj.checkBoxIsActive = dp[i][4];
- this.itemInitObj.disabled = disabled;
- var zid = i - this.getNumSeps(dp,i - 1) - 1;
- if(applyRadio)
- {
- var f = 0;
- while(f < radioSpecs.length)
- {
- if(zid >= parseInt(radioSpecs[f].start_idx) && zid <= parseInt(radioSpecs[f].end_idx))
- {
- this.itemInitObj.active = false;
- if(zid == radioSpecs[f].active)
- {
- this.itemInitObj.active = true;
- }
- this.itemInitObj.radioGroup = radioSpecs[f].groupName;
- }
- f++;
- }
- }
- menu.attachMovie("ItemSymbol","PItem_" + i,i + 1,this.itemInitObj);
- menu["PItem_" + i].onRollOver = function()
- {
- if(_level1._root.menuVisible)
- {
- var f = 0;
- while(f < this.parent.highlightedItems.length)
- {
- this.parent.highlightedItems[f].setBackgroundColor(this.parent.upBGColor);
- this.parent.highlightedItems[f].setTextColor(this.parent.upFontColor);
- this.parent.highlightedItems[f].update();
- f++;
- }
- this.parent.highlightedItems.splice(0,this.parent.highlightedItems.length);
- var d = 0;
- while(d < this._parent.treePos)
- {
- var mc = this.parent["menu_" + d]["PItem_" + this.parent["menu_" + (d + 1)].pID];
- mc.setBackgroundColor(this.parent.overBGColor);
- mc.setTextColor(this.parent.overFontColor);
- mc.update();
- this.parent.highlightedItems.push(mc);
- d++;
- }
- if(this.parent.applySound)
- {
- this.parent.rollOverSndObj.start();
- }
- if(this.parent.collapseTimeBool)
- {
- clearTimeout(this.parent.tID);
- }
- this.setBackgroundColor(this.parent.overBGColor);
- if(!this.disabled)
- {
- this.setTextColor(this.parent.overFontColor);
- }
- var inc = 0;
- var temp_depth = this.parent.depth;
- if(this.hasSubs && this._parent.treePos == classRef.family.length || this._parent.treePos == 0)
- {
- temp_depth += 1;
- }
- if(temp_depth > this._parent.treePos)
- {
- var k = this._parent.treePos + 1;
- while(k <= temp_depth)
- {
- if(!(this._parent.treePos == 0 && this.parent.depth == 0))
- {
- if(this.parent["menu_" + (this._parent.treePos + 1)].parentItemRef._name != this._name)
- {
- if(this.parent["menu_" + k] != undefined)
- {
- if(this.parent.menuFade)
- {
- this.parent["menu_" + k].onEnterFrame = function()
- {
- this._alpha -= this._parent.fadeRate;
- if(this._alpha < 0)
- {
- this.removeMovieClip();
- }
- };
- }
- else
- {
- this.parent["menu_" + k].removeMovieClip();
- }
- inc++;
- }
- }
- }
- k++;
- }
- }
- this.parent.depth -= inc;
- this.parent.family.splice(this.parent.depth,this.parent.family.length);
- if(!this.disabled)
- {
- if(this._parent.treePos > 0 || this.parent.menuShowChild == "onRollOver" || this.parent.menuShowChild == "onPress" && this.parent.isOnClick)
- {
- if(this.parent["menu_" + (this._parent.treePos + 1)].parentItemRef._name != this._name)
- {
- if(this.hasSubs)
- {
- arrayProvider = "dp";
- nexthier = this._parent.treePos + 1;
- this.parent.family.push(this.id - 1);
- var lv = 0;
- while(lv < this.parent.family.length)
- {
- arrayProvider += "_" + this.parent.family[lv];
- lv++;
- }
- if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
- {
- var ox = this._parent._x;
- var oy = this._parent._y;
- var nextMenuX = this._parent._x + this._width + this.parent.menuXSpace;
- var nextMenuY = this._parent._y + this._y - Number(this.parent[arrayProvider][0] != "") * this.parent.menuItemHeight + this.parent.menuYSpace;
- }
- else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
- {
- var ox = this._parent._x + this._x;
- var oy = this._parent._y;
- var nextMenuX = this._parent._x + this._x + this.parent.menuXSpace;
- var nextMenuY = this._parent._y + this.parent.menuItemHeight + this.parent.menuYSpace;
- }
- var nextMenuWidth = this.parent.getMenuWidth(this.parent[arrayProvider]);
- if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
- {
- var lastNextMenuX = this.parent._x + this._parent._x + this._width + this._x + nextMenuWidth;
- }
- else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
- {
- var lastNextMenuX = this.parent._x + this._parent._x + this._x + nextMenuWidth;
- }
- if(lastNextMenuX > this.parent.limitX)
- {
- var DX = lastNextMenuX - this.parent.limitX;
- if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
- {
- nextMenuX = this._parent._x - this.parent.getMenuWidth(this.parent[arrayProvider]);
- ox = this.parent._x + this._parent._x;
- }
- else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
- {
- nextMenuX -= DX;
- ox -= DX;
- }
- }
- var nextMenuHeight = this.parent.menuItemHeight * (this.parent[arrayProvider].length - Number(this.parent[arrayProvider][0] == "")) - this.parent.getNumSeps(this.parent[arrayProvider],this.parent[arrayProvider].length - 1) * (this.parent.menuItemHeight - 8);
- if(this.parent._y + this._parent._y + this._y + nextMenuHeight + this.parent.menuItemHeight > this.parent.limitY)
- {
- nextMenuY = this._parent._y + this._y - nextMenuHeight + this.parent.menuItemHeight;
- oy = nextMenuY;
- if(this._parent.treePos == 0 && this.parent.menuType == "Horizontal")
- {
- nextMenuY -= this.parent.menuItemHeight;
- }
- }
- this.parent.createMenu(nextMenuX,nextMenuY,nexthier,this.parent[arrayProvider],arrayProvider,ox,oy);
- }
- }
- }
- }
- this.parent.isOnSub = true;
- this.update();
- }
- };
- menu["PItem_" + i].onRollOut = function()
- {
- this.parent.isOnSub = false;
- this.setBackgroundColor(this.parent.upBGColor);
- if(!this.disabled)
- {
- this.setTextColor(this.parent.upFontColor);
- }
- this.update();
- if(this.parent.collapseTimeBool)
- {
- this.parent.tID = setTimeout(this.parent,"collapseAll",this.parent.collapseTime,[]);
- }
- };
- menu["PItem_" + i].onPress = function()
- {
- if(_level1._root.menuVisible and (!_level1._root.translating and !_level1._root.switchingStage))
- {
- this.setBackgroundColor(this.parent.downBGColor);
- if(!this.disabled)
- {
- this.setTextColor(this.parent.downFontColor);
- }
- this.update();
- if(!this.disabled)
- {
- if(hier == 0 && this.parent.menuShowChild == "onPress")
- {
- if(this.parent.family[0] != this.id - 1)
- {
- if(this.hasSubs)
- {
- this.parent.isOnClick = true;
- arrayProvider = "dp";
- nexthier = hier + 1;
- this.parent.family.splice(hier,this.parent.family.length);
- this.parent.family.push(this.id - 1);
- var lv = 0;
- while(lv < this.parent.family.length)
- {
- arrayProvider += "_" + this.parent.family[lv];
- lv++;
- }
- if(this.parent.menuType == "Vertical" || hier > 0)
- {
- var ox = this._parent._x;
- var oy = this._parent._y;
- var nextMenuX = this._parent._x + this._width + this.parent.menuXSpace;
- var nextMenuY = this._parent._y + this._y - Number(this.parent[arrayProvider][0] != "") * this.parent.menuItemHeight + this.parent.menuYSpace;
- }
- else if(this.parent.menuType == "Horizontal" && hier == 0)
- {
- var ox = this._parent._x + this._x;
- var oy = this._parent._y;
- var nextMenuX = this._parent._x + this._x + this.parent.menuXSpace;
- var nextMenuY = this._parent._y + this.parent.menuItemHeight + this.parent.menuYSpace;
- }
- var nextMenuWidth = this.parent.getMenuWidth(this.parent[arrayProvider]);
- if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
- {
- var lastNextMenuX = this.parent._x + this._parent._x + this._width + this._x + nextMenuWidth;
- }
- else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
- {
- var lastNextMenuX = this.parent._x + this._parent._x + this._x + nextMenuWidth;
- }
- if(lastNextMenuX > this.parent.limitX)
- {
- var DX = lastNextMenuX - this.parent.limitX;
- if(this.parent.menuType == "Vertical" || this._parent.treePos > 0)
- {
- nextMenuX = this._parent._x - this.parent.getMenuWidth(this.parent[arrayProvider]);
- ox = this.parent._x + this._parent._x;
- }
- else if(this.parent.menuType == "Horizontal" && this._parent.treePos == 0)
- {
- nextMenuX -= DX;
- ox -= DX;
- }
- }
- var nextMenuHeight = this.parent.menuItemHeight * (this.parent[arrayProvider].length - Number(this.parent[arrayProvider][0] == "")) - this.parent.getNumSeps(this.parent[arrayProvider],this.parent[arrayProvider].length - 1) * (this.parent.menuItemHeight - 8);
- if(this.parent._y + this._parent._y + this._y + nextMenuHeight + this.parent.menuItemHeight > this.parent.limitY)
- {
- nextMenuY = this._parent._y + this._y - nextMenuHeight + this.parent.menuItemHeight;
- oy = nextMenuY;
- if(this._parent.treePos == 0 && this.parent.menuType == "Horizontal")
- {
- nextMenuY -= this.parent.menuItemHeight;
- }
- }
- this.parent.createMenu(nextMenuX,nextMenuY,nexthier,this.parent[arrayProvider],arrayProvider,ox,oy);
- }
- }
- }
- }
- if(this.parent.applySound)
- {
- this.parent.pressSndObj.start();
- }
- this.parent.isOnSub = true;
- }
- };
- menu["PItem_" + i].onRelease = function()
- {
- if(_level1._root.menuVisible and (!_level1._root.translating and !_level1._root.switchingStage))
- {
- _root.specificationFromVolume = false;
- this.setBackgroundColor(this.parent.upBGColor);
- if(!this.disabled)
- {
- this.setTextColor(this.parent.upFontColor);
- }
- this.update();
- this.parent.parentPressedLabel = this._parent.parentLabel;
- this.parent.pressedLabel = this.txtLabel;
- this.parent.pressedIdx = this.id - 1;
- if(this.actionToLoad != "no" and this.actionToLoad != "en" and this.actionToLoad != "de" and this.actionToLoad != "hr")
- {
- _level1._root.setAlternativeCaption(this.alternativeCaption);
- _level1._root.setCaption(this.parent.xmlFileName,menu.pID,this.parent.parentPressedLabel,this.parent.pressedLabel,this.actionToLoad);
- }
- if(!this.disabled)
- {
- _level1._root.controller(this.actionToLoad);
- if(this.radioGroup != undefined)
- {
- var lastChecked = this.parent.getRadioActiveItem(this.radioGroup);
- this.parent["PItem_" + lastChecked].RadioButton._visible = false;
- this.RadioButton._visible = true;
- var count = 0;
- var y = 0;
- while(y < this.id)
- {
- if(dp[i] == "sep")
- {
- count++;
- }
- y++;
- }
- this.parent.setRadioActiveItem(this.radioGroup,this.id - count - 1);
- }
- if(this.isCheckBox)
- {
- var idx = this.id + this.parent.getNumSeps(dp,this.id - 1);
- dp[idx][4] = !this.checkBoxIsActive;
- }
- }
- this.parent.isOnSub = true;
- if(!this.disabled)
- {
- eval(this.parent.changeHandler).apply(this.handlerObj);
- }
- if(!this.disabled)
- {
- if(hier > 0)
- {
- this.parent.collapseAll();
- }
- }
- }
- };
- menu["PItem_" + i].onReleaseOutside = function()
- {
- this.setBackgroundColor(this.parent.upBGColor);
- if(!this.disabled)
- {
- this.setTextColor(this.parent.upFontColor);
- }
- this.update();
- this.parent.isOnSub = false;
- this.parent.collapseAll();
- };
- }
- i++;
- }
- if(this.borderState)
- {
- menu.createEmptyMovieClip("menuBorder",20000);
- menu.menuBorder.lineStyle(this.borderSize,this.borderColor,100);
- if(this.menuType == "Vertical" || hier > 0)
- {
- menu.menuBorder.drawrectangle(0,0,this.menuWidth,this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8));
- }
- else if(this.menuType == "Horizontal" && hier == 0)
- {
- menu.menuBorder.drawrectangle(0,0,this.menuWidth * (dp.length - 1 - this.numSep),this.menuItemHeight);
- }
- }
- if(this.shadowAppear)
- {
- menu.createEmptyMovieClip("shadow_mc",-20000);
- menu.shadow_mc.beginFill(0,10);
- if(this.menuType == "Vertical" || hier > 0)
- {
- menu.shadow_mc.drawrectangle(this.shadowOffset,this.shadowOffset,this.menuWidth,this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8));
- }
- else if(this.menuType == "Horizontal" && hier == 0)
- {
- menu.shadow_mc.drawrectangle(this.shadowOffset,this.shadowOffset,this.menuWidth * (dp.length - 1 - this.numSep),this.menuItemHeight);
- }
- menu.shadow_mc.endFill();
- }
- if(this.menuFade)
- {
- menu.onEnterFrame = function()
- {
- this._alpha += this._parent.fadeRate;
- if(this._alpha > 100)
- {
- delete this.onEnterFrame;
- }
- };
- }
- if(this.menuSlide && hier > 0)
- {
- this.$tmpMaskMC.clear();
- this.$tmpMaskMC.beginFill(0,0);
- if(this.menuType == "Vertical" || hier > 0)
- {
- this.$tmpMaskMC.drawrectangle(x,y,this.shadowOffset + this.menuWidth,this.shadowOffset + (this.menuItemHeight * (dp.length - numTitleExist) - this.numSep * (this.menuItemHeight - 8)));
- }
- else if(this.menuType == "Horizontal" && hier == 0)
- {
- this.$tmpMaskMC.drawrectangle(x,y,this.shadowOffset + this.menuWidth * (dp.length - 1 - this.numSep),this.shadowOffset + this.menuItemHeight);
- }
- this.$tmpMaskMC.endFill();
- menu.setMask(this.$tmpMaskMC);
- var slideCurrentTime = 0;
- if(this.menuType == "Vertical" || hier > 1)
- {
- this.onEnterFrame = function()
- {
- if(slideCurrentTime <= this.menuSlideTime)
- {
- menu._x = Math.linearTween(slideCurrentTime,ox,x - ox,this.menuSlideTime);
- slideCurrentTime++;
- }
- else
- {
- delete this.onEnterFrame;
- }
- };
- }
- else if(this.menuType == "Horizontal" && hier == 1)
- {
- this.onEnterFrame = function()
- {
- if(slideCurrentTime <= this.menuSlideTime)
- {
- menu._y = Math.linearTween(slideCurrentTime,oy,y - oy,this.menuSlideTime);
- slideCurrentTime++;
- }
- else
- {
- delete this.onEnterFrame;
- }
- };
- }
- }
- };
- HFHierMenuClass.prototype.getPressedLabel = function()
- {
- return this.pressedLabel;
- };
- HFHierMenuClass.prototype.getPressedIdx = function()
- {
- return this.pressedIdx;
- };
- HFHierMenuClass.prototype.setChangeHandler = function(ch, obj)
- {
- this.handlerObj = arguments.length >= 2 ? obj : this._parent;
- this.changeHandler = ch;
- };
- HFHierMenuClass.prototype.collapseAll = function()
- {
- this.isOnClick = false;
- this.$tmpMaskMC.clear();
- var i = 1;
- while(i <= this.depth)
- {
- if(this.menuFade)
- {
- this["menu_" + i].onEnterFrame = function()
- {
- this._alpha -= this._parent.fadeRate;
- if(this._alpha < 0)
- {
- this.removeMovieClip();
- }
- };
- }
- else
- {
- this["menu_" + i].removeMovieClip();
- }
- this.family.splice(0,this.family.length);
- i++;
- }
- var i = 0;
- while(i < this.highlightedItems.length)
- {
- this.highlightedItems[i].setBackgroundColor(this.upBGColor);
- this.highlightedItems[i].setTextColor(this.upFontColor);
- this.highlightedItems[i].update();
- i++;
- }
- this.highlightedItems.splice(0,this.highlightedItems.length);
- this.depth = 0;
- };
- HFHierMenuClass.prototype.getRadioActiveItem = function(cgn)
- {
- var i = 0;
- while(i < this.radioGroups.length)
- {
- if(this.radioGroups[i].groupName == cgn)
- {
- return this.radioGroups[i].active;
- }
- i++;
- }
- };
- HFHierMenuClass.prototype.getRadioItemLabel = function(cgn)
- {
- var i = 0;
- while(i < this.radioGroups.length)
- {
- if(this.radioGroups[i].groupName == cgn)
- {
- var dp_name = this.radioGroups[i].dp_name;
- var dp = this[dp_name];
- var id = parseInt(this.radioGroups[i].active);
- var count = 0;
- var y = 0;
- while(y < this.id)
- {
- if(dp[i] == "sep")
- {
- count++;
- }
- y++;
- }
- var idx = id + 1 + this.getNumSeps(dp,id + count);
- var label = dp[idx][0];
- return label;
- }
- i++;
- }
- };
- HFHierMenuClass.prototype.setRadioActiveItem = function(cgn, id)
- {
- var i = 0;
- while(i < this.radioGroups.length)
- {
- if(this.radioGroups[i].groupName == cgn)
- {
- this.radioGroups[i].active = id;
- break;
- }
- i++;
- }
- };
- HFHierMenuClass.prototype.getCheckBoxState = function(str, id)
- {
- var dp = this["dp_" + str];
- var idx = id + this.getNumSeps(dp,id - 1);
- return dp[idx][4];
- };
- HFHierMenuClass.prototype.setCheckBoxState = function(str, id, bool)
- {
- var dp = this["dp_" + str];
- var idx = id + this.getNumSeps(dp,id - 1);
- dp[idx][4] = bool;
- };
- HFHierMenuClass.prototype.setEnabled = function(str, id, bool)
- {
- var dp = this["dp_" + str];
- var idx = id + this.getNumSeps(dp,id - 1);
- dp[idx][5] = !bool;
- };
- HFHierMenuClass.prototype.onMouseDown = function()
- {
- if(!this.isOnSub)
- {
- this.collapseAll();
- }
- };
- HFHierMenuClass.prototype.getParentPressedLabel = function()
- {
- return this.parentPressedLabel;
- };
- HFHierMenuClass.prototype.getArrayName = function(fam)
- {
- var arr_name = "dp";
- var i = 0;
- while(i < fam.length)
- {
- arr_name += "_" + fam[i];
- i++;
- }
- return arr_name;
- };
- HFHierMenuClass.prototype.getNumSeps = function(arr, n)
- {
- var counter = 0;
- var i = 1;
- while(i < arr.length)
- {
- if(arr[i] == "sep")
- {
- counter++;
- }
- if(i - counter - 1 == n)
- {
- break;
- }
- i++;
- }
- return counter;
- };
- HFHierMenuClass.prototype.getMenuWidth = function(dp)
- {
- var len;
- var menuWidth = -1;
- var i = 0;
- while(i < dp.length)
- {
- if(i == 0)
- {
- len = dp[0].length;
- }
- else
- {
- len = dp[i][0].length;
- }
- d = dp[i][0].split("I");
- iCount = d.length - 1;
- ds = dp[i][0].split(" ");
- spaceCount = ds.length - 1;
- dt = dp[i][0].split(".");
- pointCount = dt.length - 1;
- realLength = len * this.txtSize - iCount * (this.txtSize - 3) - spaceCount * (this.txtSize - 3) - pointCount * (this.txtSize - 5);
- if(realLength > menuWidth)
- {
- menuWidth = realLength;
- }
- i++;
- }
- menuWidth += 22;
- return menuWidth;
- };
- HFHierMenuClass.prototype.getOneMenuWidth = function(dp)
- {
- var len;
- var menuWidth = -1;
- len = dp.length;
- d = dp.split("I");
- iCount = d.length - 1;
- ds = dp.split(" ");
- spaceCount = ds.length - 1;
- dt = dp.split(".");
- pointCount = dt.length - 1;
- menuWidth = len * this.txtSize - iCount * (this.txtSize - 3) - spaceCount * (this.txtSize - 3) - pointCount * (this.txtSize - 1);
- menuWidth += 22;
- return menuWidth;
- };
- Object.registerClass("HFHierMenuSymbol",HFHierMenuClass);
-